//
//  LQYTopView.m
//  基本框架
//
//  Created by runone02 on 2018/6/26.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#import "LQYTopView.h"

@implementation LQYTopView


- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    
    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.text = @"名字";
    self.nameLabel.textColor = [UIColor blackColor];
    [self addSubview:self.nameLabel];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self);
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(30);
    }];
    
    self.QRCodeBtn = [[UIButton alloc]init];
    self.QRCodeBtn.backgroundColor = [UIColor redColor];
    [self addSubview:self.QRCodeBtn];
    
    [self.QRCodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.nameLabel);
        make.left.mas_equalTo(self.nameLabel.mas_right).with.offset(10);
        make.width.mas_equalTo(10);
        make.height.mas_equalTo(10);
    }];
    
    self.icon = [[UIButton alloc]init];
    self.icon.backgroundColor = [UIColor yellowColor];
    [self addSubview: self.icon];
    
    [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.nameLabel);
        make.right.mas_equalTo(self).with.offset(-20);
        make.width.height.mas_equalTo(20);
    }];
    
    self.firmNameLabel = [[UILabel alloc]init];
    self.firmNameLabel.text = @"公司名";
    self.firmNameLabel.textColor = [UIColor blackColor];
    [self addSubview:self.firmNameLabel];
    
    [self.firmNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo (self.nameLabel.mas_bottom).with.offset(30);
        make.left.mas_equalTo(10);
        make.width.mas_equalTo([UIScreen mainScreen].bounds.size.width/3);
    }];
    
    self.authenticationBtn = [[UIButton alloc]init];
    [self.authenticationBtn setTitle:@"高级认证" forState:UIControlStateNormal];
    [self.authenticationBtn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
    [self addSubview:self.authenticationBtn];
    
    [self.authenticationBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.firmNameLabel);
        make.left.mas_equalTo(self.firmNameLabel);
         make.width.mas_equalTo([UIScreen mainScreen].bounds.size.width/3);
    }];
    
    self.medalBtn = [[UIButton alloc]init];
    [self.medalBtn setTitle:@"勋章" forState:UIControlStateNormal];
    [self.medalBtn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
    [self addSubview:self.medalBtn];
    
    [self.medalBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.firmNameLabel);
        make.right.mas_equalTo(self).with.offset(-20);
        make.width.mas_equalTo([UIScreen mainScreen].bounds.size.width/3);
    }];
    
    self.lineView = [[UIView alloc]init];
    self.lineView.backgroundColor = [UIColor lightGrayColor];
    [self addSubview: self.lineView];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.firmNameLabel.mas_bottom).with.offset(10);
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(1);
    }];
    
    self.stateBtn = [[UIButton alloc]init];
    [self.stateBtn setTitle:@"添加工作状态...." forState:UIControlStateNormal];
    [self.stateBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [self addSubview:self.stateBtn];
    [self.stateBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.lineView.mas_bottom).with.offset(20);
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        
    }];
}

@end
